/*     */ package dm.jdbc.dbaccess;
/*     */ 
/*     */ import dm.jdbc.util.SQLStateMapping;
/*     */ import dm.jdbc.util.SQLStateRange;
/*     */ import java.io.IOException;
/*     */ import java.sql.SQLException;
/*     */ import java.sql.SQLWarning;
/*     */ import java.util.ResourceBundle;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class DBError
/*     */ {
/*  33 */   public static boolean useSQLState = false;
/*     */   
/*     */   public static void throwSQLException(String reason, int errCode) throws SQLException
/*     */   {
/*  37 */     if ((errCode == 0) || (errCode == 13))
/*     */     {
/*  39 */       return;
/*     */     }
/*     */     
/*  42 */     String SQLState = getSQLStateByErrorCode(errCode);
/*  43 */     throw new SQLException(reason, SQLState, errCode);
/*     */   }
/*     */   
/*     */   public static void throwSQLException(String reason) throws SQLException
/*     */   {
/*  48 */     throw new SQLException(reason);
/*     */   }
/*     */   
/*     */   public static void throwSQLException(int errCode) throws SQLException
/*     */   {
/*  53 */     String state = getSQLStateByErrorCode(errCode);
/*  54 */     String info = getErrorInfoByErrorCode(errCode);
/*     */     
/*  56 */     throw new SQLException(info, state, errCode);
/*     */   }
/*     */   
/*     */   public static String getSQLStateByErrorCode(int errCode)
/*     */   {
/*  61 */     for (int j = 0; j < mappings.length; j++)
/*     */     {
/*  63 */       if (errCode == mappings[j].err)
/*     */       {
/*  65 */         return mappings[j].SQLState;
/*     */       }
/*     */     }
/*     */     
/*  69 */     for (int k = 0; k < ranges.length; k++)
/*     */     {
/*  71 */       if ((errCode >= ranges[k].low) && (errCode <= ranges[k].high))
/*     */       {
/*  73 */         return ranges[k].SQLState;
/*     */       }
/*     */     }
/*     */     
/*  77 */     return "22000";
/*     */   }
/*     */   
/*     */   public static String getErrorInfoByErrorCode(int errCode)
/*     */   {
/*  82 */     for (int j = 0; j < mappings.length; j++)
/*     */     {
/*  84 */       if (errCode == mappings[j].err)
/*     */       {
/*  86 */         return mappings[j].errInfo;
/*     */       }
/*     */     }
/*     */     
/*  90 */     return "";
/*     */   }
/*     */   
/*     */   public static void throwUnsupportedSQLException() throws SQLException
/*     */   {
/*  95 */     throwSQLException(6030);
/*     */   }
/*     */   
/*     */   public static SQLWarning addSQLWarning(SQLWarning oldWarning, int warnCode)
/*     */   {
/* 100 */     String state = getSQLStateByErrorCode(warnCode);
/* 101 */     String info = getErrorInfoByErrorCode(warnCode);
/*     */     
/* 103 */     SQLWarning warn = new SQLWarning(info, state, warnCode);
/* 104 */     if (oldWarning == null)
/*     */     {
/* 106 */       return warn;
/*     */     }
/*     */     
/* 109 */     oldWarning.setNextWarning(warn);
/*     */     
/* 111 */     return oldWarning;
/*     */   }
/*     */   
/*     */   public static void SQLToIOException(SQLException sqlexception) throws IOException
/*     */   {
/* 116 */     throw new IOException(sqlexception.getMessage());
/*     */   }
/*     */   
/*     */   public static String ErrorToSQLState(int i)
/*     */   {
/* 121 */     for (int j = 0; j < mappings.length; j++)
/*     */     {
/* 123 */       if (i == mappings[j].err)
/*     */       {
/* 125 */         return mappings[j].SQLState;
/*     */       }
/*     */     }
/*     */     
/* 129 */     for (int k = 0; k < ranges.length; k++)
/*     */     {
/* 131 */       if ((i >= ranges[k].low) && (i <= ranges[k].high))
/*     */       {
/* 133 */         return ranges[k].SQLState;
/*     */       }
/*     */     }
/*     */     
/* 137 */     return "22000";
/*     */   }
/*     */   
/* 140 */   static final SQLStateMapping[] mappings = {
/* 141 */     new SQLStateMapping(100, "02000", ""), 
/* 142 */     new SQLStateMapping(0, "00000", ""), 
/*     */     
/* 144 */     new SQLStateMapping(117, "01000", 
/* 145 */     Const.res.getString("warning.rangeWarn")), 
/* 146 */     new SQLStateMapping(119, "01000", 
/* 147 */     Const.res.getString("warning.listWarn")), 
/*     */     
/* 149 */     new SQLStateMapping(63529, "42000", ""), 
/* 150 */     new SQLStateMapping(63535, "30000", ""), 
/* 151 */     new SQLStateMapping(63533, "42000", ""), 
/* 152 */     new SQLStateMapping(63532, "30000", ""), 
/* 153 */     new SQLStateMapping(63531, "42000", ""), 
/* 154 */     new SQLStateMapping(59529, "08000", ""), 
/*     */     
/* 156 */     new SQLStateMapping(64536, "3D000", ""), 
/* 157 */     new SQLStateMapping(64535, "3D000", ""), 
/* 158 */     new SQLStateMapping(64530, "0P000", ""), 
/* 159 */     new SQLStateMapping(64529, "3F000", ""), 
/*     */     
/* 161 */     new SQLStateMapping(64507, "3B000", ""), 
/* 162 */     new SQLStateMapping(64505, "34000", ""), 
/* 163 */     new SQLStateMapping(64501, "3D000", ""), 
/* 164 */     new SQLStateMapping(64475, "0P000", ""), 
/*     */     
/* 166 */     new SQLStateMapping(64436, "25006", ""), 
/* 167 */     new SQLStateMapping(64435, "25000", ""), 
/*     */     
/* 169 */     new SQLStateMapping(64336, "28000", ""), 
/*     */     
/* 171 */     new SQLStateMapping(64134, "27000", ""), 
/* 172 */     new SQLStateMapping(64133, "27000", ""), 
/* 173 */     new SQLStateMapping(64132, "09000", ""), 
/*     */     
/* 175 */     new SQLStateMapping(63835, "2201B", ""), 
/*     */     
/* 177 */     new SQLStateMapping(63036, "22000", ""), 
/* 178 */     new SQLStateMapping(63035, "22000", ""), 
/* 179 */     new SQLStateMapping(63034, "22003", 
/* 180 */     Const.res.getString("error.dataOverflow")), 
/* 181 */     new SQLStateMapping(63033, "22012", ""), 
/* 182 */     new SQLStateMapping(63032, "22021", ""), 
/* 183 */     new SQLStateMapping(63031, "22000", ""), 
/* 184 */     new SQLStateMapping(63030, "22000", ""), 
/* 185 */     new SQLStateMapping(63029, "22019", ""), 
/* 186 */     new SQLStateMapping(63028, "22001", ""), 
/* 187 */     new SQLStateMapping(63025, "22000", ""), 
/* 188 */     new SQLStateMapping(63024, "22008", 
/* 189 */     Const.res.getString("DM_SQLSTATE_22008")), 
/* 190 */     new SQLStateMapping(63023, "22000", ""), 
/* 191 */     new SQLStateMapping(63022, "22000", ""), 
/* 192 */     new SQLStateMapping(63021, "22007", ""), 
/* 193 */     new SQLStateMapping(63018, "22015", ""), 
/* 194 */     new SQLStateMapping(63017, "22007", ""), 
/* 195 */     new SQLStateMapping(63016, "22000", ""), 
/* 196 */     new SQLStateMapping(63014, "22000", ""), 
/* 197 */     new SQLStateMapping(63013, "22000", ""), 
/* 198 */     new SQLStateMapping(63012, "22007", ""), 
/* 199 */     new SQLStateMapping(63011, "22000", ""), 
/*     */     
/* 201 */     new SQLStateMapping(62486, "25000", ""), 
/* 202 */     new SQLStateMapping(62485, "3B001", ""), 
/*     */     
/* 204 */     new SQLStateMapping(62335, "22000", ""), 
/* 205 */     new SQLStateMapping(62230, "24000", ""), 
/* 206 */     new SQLStateMapping(62221, "3D000", ""), 
/* 207 */     new SQLStateMapping(62218, "3F000", ""), 
/* 208 */     new SQLStateMapping(62121, "42000", ""), 
/*     */     
/* 210 */     new SQLStateMapping(59526, "08000", ""), 
/* 211 */     new SQLStateMapping(61735, "08000", ""), 
/* 212 */     new SQLStateMapping(61734, "08000", ""), 
/* 213 */     new SQLStateMapping(61733, "08004", ""), 
/*     */     
/* 215 */     new SQLStateMapping(6001, "08S01", 
/* 216 */     Const.res.getString("error.cumunationError")), 
/* 217 */     new SQLStateMapping(6002, "HY021", 
/* 218 */     Const.res.getString("error.msgCheckError")), 
/* 219 */     new SQLStateMapping(6003, "40003", 
/* 220 */     Const.res.getString("error.sqlIsNullOrEmpty")), 
/* 221 */     new SQLStateMapping(6004, "22003", 
/* 222 */     Const.res.getString("error.overflow")), 
/* 223 */     new SQLStateMapping(6005, "22007", 
/* 224 */     Const.res.getString("error.invalidTimeIntervalValue")), 
/* 225 */     new SQLStateMapping(6066, "22015", 
/* 226 */     Const.res.getString("error.intervalValueOverflow")), 
/* 227 */     new SQLStateMapping(6006, "HY004", 
/* 228 */     Const.res.getString("error.unsupportedType")), 
/* 229 */     new SQLStateMapping(6007, "HY096", 
/* 230 */     Const.res.getString("error.dataConvertionError")), 
/* 231 */     new SQLStateMapping(6008, "01001", 
/* 232 */     Const.res.getString("error.readOnlyConnection")), 
/* 233 */     new SQLStateMapping(6009, "HY004", 
/* 234 */     Const.res.getString("error.invalidSqlType")), 
/* 235 */     new SQLStateMapping(6010, "HY093", 
/* 236 */     Const.res.getString("error.invalidSequence")), 
/* 237 */     new SQLStateMapping(6011, "3D000", 
/* 238 */     Const.res.getString("error.invalidDbName")), 
/* 239 */     new SQLStateMapping(6012, "22003", 
/* 240 */     Const.res.getString("error.invalidDigitalTypeFormat")), 
/* 241 */     new SQLStateMapping(6013, "22007", 
/* 242 */     Const.res.getString("error.invalidDateTypeFormat")), 
/* 243 */     new SQLStateMapping(6014, "22007", 
/* 244 */     Const.res.getString("error.invalidTimeTypeFormat")), 
/* 245 */     new SQLStateMapping(6015, "22007", 
/* 246 */     Const.res.getString("error.invalidDateTimeTypeFormat")), 
/* 247 */     new SQLStateMapping(6016, "HY004", 
/* 248 */     Const.res.getString("error.invalidColumnType")), 
/* 249 */     new SQLStateMapping(6017, "HY111", 
/* 250 */     Const.res.getString("error.invalidColumnName")), 
/* 251 */     new SQLStateMapping(6018, "22003", 
/* 252 */     Const.res.getString("error.invalidBigDecimalTypeFormat")), 
/* 253 */     new SQLStateMapping(6019, "01001", 
/* 254 */     Const.res.getString("error.invalidResultsetType")), 
/* 255 */     new SQLStateMapping(6020, "HY107", 
/* 256 */     Const.res.getString("error.invalidRowNo")), 
/* 257 */     new SQLStateMapping(6021, "HY020", 
/* 258 */     Const.res.getString("error.emptyResultset")), 
/* 259 */     new SQLStateMapping(6022, "HYC00", 
/* 260 */     Const.res.getString("error.invalidCursorMoveDirection")), 
/* 261 */     new SQLStateMapping(6023, "HY024", 
/* 262 */     Const.res.getString("error.forwardOnlyResultset")), 
/* 263 */     new SQLStateMapping(6024, "HY024", 
/* 264 */     Const.res.getString("error.notAllowNull")), 
/* 265 */     new SQLStateMapping(6025, "3D000", 
/* 266 */     Const.res.getString("error.invalidDbName")), 
/*     */     
/* 268 */     new SQLStateMapping(6026, "01001", 
/* 269 */     Const.res.getString("error.resultsetNotInInsertStatus")), 
/* 270 */     new SQLStateMapping(6027, "01001", 
/* 271 */     Const.res.getString("error.resultsetInInsertStatus")), 
/* 272 */     new SQLStateMapping(6029, "42000", 
/* 273 */     Const.res.getString("error.resultsetInReadOnlyStatus")), 
/* 274 */     new SQLStateMapping(6030, "HYC00", 
/* 275 */     Const.res.getString("error.unsupportedInterfase")), 
/*     */     
/* 277 */     new SQLStateMapping(6032, "42S22", 
/* 278 */     Const.res.getString("error.invalidSequenceNo")), 
/* 279 */     new SQLStateMapping(6033, "HY024", 
/* 280 */     Const.res.getString("error.invalidReturnValue")), 
/* 281 */     new SQLStateMapping(6034, "08007", 
/* 282 */     Const.res.getString("error.resultsetClosed")), 
/* 283 */     new SQLStateMapping(6035, "08007", 
/* 284 */     Const.res.getString("error.statementHandleClosed")), 
/* 285 */     new SQLStateMapping(6036, "HY024", 
/* 286 */     Const.res.getString("error.invalidParameterValue")), 
/* 287 */     new SQLStateMapping(6038, "HYC00", 
/* 288 */     Const.res.getString("error.invalidTranIsolation")), 
/* 289 */     new SQLStateMapping(6039, "HY012", 
/* 290 */     Const.res.getString("error.savepointInAutoCommitMode")), 
/* 291 */     new SQLStateMapping(6040, "HY012", 
/* 292 */     Const.res.getString("error.rollbackToSavepointInAutoCommitMode")), 
/* 293 */     new SQLStateMapping(6041, "HY012", 
/* 294 */     Const.res.getString("error.releaseSavepointInAutoCommitMode")), 
/* 295 */     new SQLStateMapping(6042, "HY012", 
/* 296 */     Const.res.getString("error.commitInAutoCommitMode")), 
/* 297 */     new SQLStateMapping(6043, "HY012", 
/* 298 */     Const.res.getString("error.rollbackInAutoCommitMode")), 
/* 299 */     new SQLStateMapping(6044, "21S01", 
/* 300 */     Const.res.getString("error.invalidInputParameterValue")), 
/* 301 */     new SQLStateMapping(6045, "21S01", 
/* 302 */     Const.res.getString("error.invalidOutParameterValue")), 
/* 303 */     new SQLStateMapping(6046, "42000", 
/* 304 */     Const.res.getString("error.canNotGetSavepointID")), 
/* 305 */     new SQLStateMapping(6047, "42000", 
/* 306 */     Const.res.getString("error.canNotGetSavepointName")), 
/* 307 */     new SQLStateMapping(6048, "22002", 
/* 308 */     Const.res.getString("error.unknownParameterType")), 
/* 309 */     new SQLStateMapping(6049, "HY104", 
/* 310 */     Const.res.getString("error.invalidScale")), 
/* 311 */     new SQLStateMapping(6050, "HY093", 
/* 312 */     Const.res.getString("error.invalidParameterName")), 
/* 313 */     new SQLStateMapping(6051, "HY092", 
/* 314 */     Const.res.getString("error.invalidSavepointName")), 
/* 315 */     new SQLStateMapping(6064, "", 
/* 316 */     Const.res.getString("error.invalidSavepoint")), 
/* 317 */     new SQLStateMapping(6052, "HY104", 
/* 318 */     Const.res.getString("error.tooBigParameterPrecsicion")), 
/* 319 */     new SQLStateMapping(6053, "HY009", 
/* 320 */     Const.res.getString("error.savepointReleased")), 
/* 321 */     new SQLStateMapping(6054, "21S01", 
/* 322 */     Const.res.getString("error.unbindedParameter")), 
/* 323 */     new SQLStateMapping(6055, "HY024", 
/* 324 */     Const.res.getString("error.invalidCursorValue")), 
/* 325 */     new SQLStateMapping(6065, "", 
/* 326 */     Const.res.getString("error.invalidResultSetField")), 
/* 327 */     new SQLStateMapping(6057, "22025", 
/* 328 */     Const.res.getString("error.invalidLenOrOffset")), 
/*     */     
/* 330 */     new SQLStateMapping(6060, "08003", 
/* 331 */     Const.res.getString("error.connectionClosedOrNotBuild")), 
/* 332 */     new SQLStateMapping(6061, "08003", 
/* 333 */     Const.res.getString("error.encrypt.negotiate.fail")), 
/* 334 */     new SQLStateMapping(6062, "08003", 
/* 335 */     Const.res.getString("error.init.kerberos.fail")), 
/* 336 */     new SQLStateMapping(6063, "08003", 
/* 337 */     Const.res.getString("error.getFQDN.fail")), 
/* 338 */     new SQLStateMapping(20000, "", 
/* 339 */     Const.res.getString("error.SwitchedSused")), 
/* 340 */     new SQLStateMapping(20001, "", 
/* 341 */     Const.res.getString("error.SwitchedFailed")), 
/* 342 */     new SQLStateMapping(20002, "", 
/* 343 */     Const.res.getString("error.SSLInitFailed")), 
/* 344 */     new SQLStateMapping(20003, "", 
/* 345 */     Const.res.getString("error.LobDataHasFreed")), 
/* 346 */     new SQLStateMapping(20004, "", 
/* 347 */     Const.res.getString("error.fatalError")), 
/* 348 */     new SQLStateMapping(20005, "", 
/* 349 */     Const.res.getString("error.invalidStmtCall")), 
/* 350 */     new SQLStateMapping(20006, "", 
/* 351 */     Const.res.getString("error.registedNotCursorType")), 
/* 352 */     new SQLStateMapping(20007, "", 
/* 353 */     Const.res.getString("error.colIndexLowerOne")), 
/* 354 */     new SQLStateMapping(20008, "", 
/* 355 */     Const.res.getString("error.colIndexesNull")), 
/* 356 */     new SQLStateMapping(20009, "", 
/* 357 */     Const.res.getString("error.colName")), 
/* 358 */     new SQLStateMapping(20010, "", 
/* 359 */     Const.res.getString("error.colNames")), 
/* 360 */     new SQLStateMapping(20011, "", 
/* 361 */     Const.res.getString("error.nocolumnset")), 
/* 362 */     new SQLStateMapping(20012, "", 
/* 363 */     Const.res.getString("error.nocolnameset")), 
/* 364 */     new SQLStateMapping(20013, "", 
/* 365 */     Const.res.getString("error.nocolindexset")), 
/* 366 */     new SQLStateMapping(20014, "", 
/* 367 */     Const.res.getString("error.colindexunset")), 
/* 368 */     new SQLStateMapping(20015, "", 
/* 369 */     Const.res.getString("error.colnameunset")), 
/* 370 */     new SQLStateMapping(20016, "", 
/* 371 */     Const.res.getString("error.jrstnshowdeleted")), 
/* 372 */     new SQLStateMapping(20017, "", 
/* 373 */     Const.res.getString("error.serilobioex")), 
/* 374 */     new SQLStateMapping(20018, "", 
/* 375 */     Const.res.getString("error.connurlerror")), 
/* 376 */     new SQLStateMapping(20019, "", 
/* 377 */     Const.res.getString("error.commadNull")), 
/* 378 */     new SQLStateMapping(20020, "", 
/* 379 */     Const.res.getString("error.cachedRowSetCursorMoved")), 
/* 380 */     new SQLStateMapping(20021, "", 
/* 381 */     Const.res.getString("error.cachedRowSetRsNotSupt")), 
/* 382 */     new SQLStateMapping(20023, "", 
/* 383 */     Const.res.getString("error.cachedRowSetRowNpopu")), 
/* 384 */     new SQLStateMapping(20024, "", 
/* 385 */     Const.res.getString("error.cachedRowSetStartRowNNeg")), 
/* 386 */     new SQLStateMapping(20025, "", 
/* 387 */     Const.res.getString("error.cachedRowSetRsNull")), 
/* 388 */     new SQLStateMapping(20026, "", 
/* 389 */     Const.res.getString("error.cachedRowSetRsTooFew")), 
/* 390 */     new SQLStateMapping(6067, "22001", 
/* 391 */     Const.res.getString("error.StringCut")), 
/* 392 */     new SQLStateMapping(6068, "22000", 
/* 393 */     Const.res.getString("error.invalidHex")), 
/* 394 */     new SQLStateMapping(6069, "", 
/* 395 */     Const.res.getString("error.invalidCipher")) };
/*     */   
/* 397 */   static final SQLStateRange[] ranges = {
/* 398 */     new SQLStateRange(101, 203, 
/* 399 */     "01000"), 
/* 400 */     new SQLStateRange(63539, 
/* 401 */     63636, "42000"), 
/* 402 */     new SQLStateRange(62427, 
/* 403 */     62436, "23000") };
/*     */ }


/* Location:              D:\Program Files\DBMS_20150813\jdbc\Dm7JdbcDriver17.jar!\dm\jdbc\dbaccess\DBError.class
 * Java compiler version: 2 (46.0)
 * JD-Core Version:       0.7.1
 */